<html>
<head><meta charset="utf-8"><title>Handling of unresolved where clauses · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html">Handling of unresolved where clauses</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="184017257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184017257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184017257">(Dec 21 2019 at 16:51)</a>:</h4>
<p>I'm refactoring the Chalk lowering code in rust-analyzer a bit (preparing for the chalk-ir changes), and I was wondering what the best way to handle errors in where clauses is (e.g. <code>where T: UnknownTrait</code>). We used to lower them to a clause that can never be met by 'making up' a trait without impls, but that is kind of an ugly hack. We could also just leave them out, i.e. make them always succeed. Or we could add a <code>WhereClause::Error</code> variant and have the Chalk program clause code decide on a case-by-case basis.</p>
<p>I'm not actually sure what the best behavior is; I think it should be 'whatever makes the most code type-check', but actually both approaches can lead to errors (leaving out the clause can cause more ambiguities).</p>
<p>Finally, this problem probably becomes much less important the more correct rust-analyzer's name resolution becomes, so maybe the best answer is 'whatever is simplest' ;)</p>



<a name="184017566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184017566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184017566">(Dec 21 2019 at 17:00)</a>:</h4>
<p>Sounds a bit like <code>Goal::CannotProve</code>?</p>



<a name="184017780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184017780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184017780">(Dec 21 2019 at 17:07)</a>:</h4>
<p>Sure, that's not something that's available on the chalk-ir level though (if we introduce a <code>WhereClause::Error</code>, that might get involved)</p>



<a name="184018452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184018452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184018452">(Dec 21 2019 at 17:26)</a>:</h4>
<blockquote>
<p>We could also just leave them out, i.e. make them always succeed.</p>
</blockquote>
<p>Seems like one can't get simpler than this? :)</p>



<a name="184019747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184019747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184019747">(Dec 21 2019 at 18:05)</a>:</h4>
<blockquote>
<p>Seems like one can't get simpler than this? :)</p>
</blockquote>
<p>Yeah, and that's what I've implemented now, I'm just wondering whether the potential fallout from that is acceptable</p>



<a name="184020308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184020308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184020308">(Dec 21 2019 at 18:21)</a>:</h4>
<p>it's really probably fine, doesn't change much in <code>analysis-stats</code> actually :)</p>



<a name="184098188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184098188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184098188">(Dec 23 2019 at 11:21)</a>:</h4>
<p>I think leaving them out is <em>probably</em> what you want</p>



<a name="184098194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184098194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184098194">(Dec 23 2019 at 11:21)</a>:</h4>
<p>Cannot prove etc feels too strong</p>



<a name="184098198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Handling%20of%20unresolved%20where%20clauses/near/184098198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Handling.20of.20unresolved.20where.20clauses.html#184098198">(Dec 23 2019 at 11:21)</a>:</h4>
<p>That would make it an error to invoke those functions (because we cannot prove that they are callable)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>